home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_200
/
256_01
/
fun12h.a
< prev
next >
Wrap
Text File
|
1988-01-06
|
2KB
|
54 lines
;---------------------------------------------------------------------
; ASM88 FILE: FUN12H.A Search for Next Matching Entry
; ----------
; WRITTEN: 26/10/87
; -------
; PURPOSE: This is one of a series of files which take
; ------- advantage of INT 21H functions under MS-DOS.
; In each case the error situation is marked by
; the carry flag being set. We use the De Smet
; external variable '_carryf' to see whether the
; carry is set on return from the function.
; If so, the error code can be used to obtain
; information about the specific error.
;
; USAGE: int FUN12H(fcb_buf, &_carryf)
; ----- char *fcb_buf; /* FCB buffer used in FUN11H */
; char *_carryf;
;
; DEPENDENCIES: De Smet C V 2.44+
; ------------
; Copyright 1987 - Cogar Computer Services Pty. Ltd
;---------------------------------------------------------------------
CSEG
PUBLIC FUN12H_
FUN12H_:
push bp ; normal De Smet C start
mov bp,sp ; point to the stack
mov ax,ds ; and make ES common with DS
mov es,ax
;----------------------------------------------------------------------
; The unique programme follows.
;----------------------------------------------------------------------
mov dx,[bp+4] ; address of the un-opened FCB
mov ah,12H ; the Function No.
int 21h
cmp al,0ffh ; this is the error check
je FUN12H_ERROR
xor ax,ax ; prepare for normal return
jmp FUN12H_QUIT
FUN12H_ERROR:
mov si,[bp+6] ; get address of '_carryf' variable
xor ax,ax
mov al,2 ; "no file found" error
mov byte [si],1 ; return with _carryf = 1
;----------------------------------------------------------------------
; Normal programme termination.
;----------------------------------------------------------------------
FUN12H_QUIT:
pop bp ; restore starting conditions
ret
;----------------------------------------------------------------------